import {
  platformDictList,
  savePlatformDict,
  platformDictAllList,
  getPlatformDictId,
  updatePlatformDictId,
  checkDict,
  deleteDict,
  getDictType,
  searchDictByType,
  upSort,
  downSort,
} from '../services/dictionary';
import { Request } from '../common/Request';

const modelRequest = new Request([
  {
    type: 'platformDictList',
    requestWay: platformDictList,
  },
  {
    type: 'savePlatformDict',
    requestWay: savePlatformDict,
  },
  {
    type: 'platformDictAllList',
    requestWay: platformDictAllList,
  },
  {
    type: 'getDictId',
    requestWay: getPlatformDictId,
  },
  {
    type: 'updateDictId',
    requestWay: updatePlatformDictId,
  },
  {
    type: 'checkDict',
    requestWay: checkDict,
  },
  {
    type: 'deleteDict',
    requestWay: deleteDict,
  },
  {
    type: 'getDictType',
    requestWay: getDictType,
  },
  {
    type: 'searchType',
    requestWay: searchDictByType,
  },
  {
    type: 'upSort',
    requestWay: upSort,
  },
  {
    type: 'downSort',
    requestWay: downSort,
  },
]);

export default {
  namespace: 'PlatformDict',

  state: {},

  effects: modelRequest.effects,
  reducers: modelRequest.reducer,
};
